package com.junzhiit.nengji.dao.impl;

import org.springframework.stereotype.Repository;

import com.bainaeco.framework.base.dao.AbstractBaseDAO;
import com.bainaeco.framework.common.jdbc.StatementParameter;
import com.bainaeco.framework.enums.IsDelete;
import com.junzhiit.nengji.dao.NoticeReadDAO;
import com.junzhiit.nengji.model.NoticeRead;

@Repository
public class NoticeReadDAOImpl extends AbstractBaseDAO<NoticeRead> implements NoticeReadDAO {


	@Override
	public NoticeRead queryByUserId(String userId) {
		StringBuffer sql = new StringBuffer();
		sql.append("select id,user_id userId,notice_id noticeId,past_record pastRecord,current_record currentRecord,finish_reading finishReading ");
		sql.append(" from notice_read ");
		sql.append(" where is_delete=? ");
		sql.append(" and user_id = ? ");
		StatementParameter params = new StatementParameter();
		params.setInt(IsDelete.NO.toIntValue());
		params.setString(userId);
		return super.query(sql.toString(), NoticeRead.class, params);
	}

}
